

<include file="public@header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a >参赛管理</a></li>

    </ul>

    <form class="well form-inline margin-top-20" method="get" >

        用户名称:
        <input type="text" class="form-control" id="username" style="width: 120px;"  placeholder="用户名称">

        比赛名称:
        <input type="text" class="form-control" id="gamename" style="width: 120px;"   placeholder="比赛名称">



        开始时间:
        <input type="text" class="form-control js-bootstrap-date" id="start_time"
               value="{$start_time|default=''}"
               style="width: 140px;" autocomplete="off">

        结束时间:
        <input type="text" class="form-control js-bootstrap-date" id="end_time"
               value="{$start_time|default=''}"
               style="width: 140px;" autocomplete="off">

        <input type="button" id="selectval" class="btn btn-primary" value="搜索" />


        <a class="btn btn-danger" href="{:url('gameindex/index')}">清空</a>
    </form>

    <table class="table table-hover table-bordered">

        <table class="layui-hide" id="test" lay-filter="test"></table>

        <script type="text/html" id="toolbarDemo">
            <div class="layui-btn-container">
                <button class="layui-btn layui-btn-sm" id='allscore'> </button>
<!--                <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>-->
<!--                <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>-->
            </div>
        </script>
        <script type="text/html" id="barDemo">
            <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
            <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
        </script>

        <!--    自定义    -->
        <script type="text/html" id="titleTpl">
            {{#  if(d.stype == 1){ }}
            积分
            {{#  } else { }}
            参赛券
            {{#  } }}
        </script>
        <script type="text/html" id="titleTpl1">
            {{#  if(d.top ==1){ }}
            展示
            {{#  } else { }}
            隐藏
            {{#  } }}
        </script>

        <script type="text/html" id="titleTpl2">
            <a class="layui-btn layui-btn-xs" lay-event="inuser">{{d.inuser}}</a>
        </script>

        <script>



            layui.use('table', function(){
                var table = layui.table;


                var tableIns =table.render({
                    elem: '#test' ,
                    url:'index',
                    method: 'post',
                    toolbar: '#toolbarDemo',
                    title: '用户数据表',
                    totalRow: true ,
                    cols: [[
                        {field:'id', title:'ID', width:80, fixed: 'left',totalRowText:'合计'},
                        {field:'user_nickname', title:'用户名'},
                        {field:'game_name', title:'比赛'},
                        {field:'stype', title:'类型', templet: '#titleTpl'},
                        {field:'score', title:'参赛积分' ,sort: true, totalRow: true},
                        {field:'scorec', title:'成本积分',sort: true, totalRow: true},
                        {field:'ticket_log_name', title:'参赛券'},
                        {field:'times', title:'时间'}



                    ]]
                    ,page: true,
                    done: function(res, curr, count){

                        console.log(res);

                        $("#allscore").html(res.msg)
                    }
                });


                $("#selectval").click(function (){

                    var username=$("#username").val();
                    var gamename=$("#gamename").val();
                    var start_time=$("#start_time").val();
                    var end_time=$("#end_time").val();
                    tableIns.reload({
                        where: { username: username,gamename:gamename,start_time:start_time,end_time:end_time} ,
                        page: { curr: 1  }
                    });

                })


            });
        </script>


    </table>

</div>
<script src="__STATIC__/js/admin.js"></script>
</body>
</html>